<?php

namespace addons\sum\controller;

use app\admin\model\sum\Slideshows as SlideshowsModel;
use app\admin\model\sum\Slides as SlidesModel;

class Slides extends Common
{

    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    public function index() 
    {
        $slug=$this->request->request('slug','home');
        $per_page=$this->request->request('per_page','10');
        $slideShow=SlideshowsModel::where('slug',$slug)->find();
        if(!$slideShow){
            $this->error('参数错误');
        }
        $slides=SlidesModel::where('slideshow_id',$slideShow['id'])->where('status','normal')->Order('weigh DESC')->paginate($per_page);
        $this->success('操作成功', $slides);
    }
}
